import Vue from 'vue'
import App from './App.vue'
import Home from './views/home'
import {
  Pagination, Loading, Drawer, Input, Autocomplete, Divider, Link, Button, Tag, Card, Message
} from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import VueRouter from 'vue-router'
import Copyright from './components/copyright.vue'
Vue.use(VueRouter)
Vue.use(Pagination)
Vue.use(Loading.directive);
Vue.use(Drawer);
Vue.use(Input);
Vue.use(Autocomplete);
Vue.use(Divider);
Vue.use(Link);
Vue.use(Button);
Vue.use(Tag);
Vue.use(Card);

Vue.config.productionTip = false
Vue.prototype.$message = Message

const router = new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/result',
      name: 'result',
      component: () => import('./views/result')
    },
    {
      path: '/detail/:id',
      name: 'detail',
      component: () => import('./components/detail')
    },
    // {
    //   path: '/500',
    //   name: 'error_500',
    //   meta: {
    //     hideInMenu: true
    //   },
    //   component: () => import('@/view/error-page/500.vue')
    // },
    // {
    //   path: '*',
    //   name: 'error_404',
    //   meta: {
    //     hideInMenu: true
    //   },
    //   component: () => import('@/view/error-page/404.vue')
    // }
  ],
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  }
})
// router.beforeEach((to, from, next) => {

// })

Vue.component('copyright', Copyright)


new Vue({
  render: h => h(App),
  router
}).$mount('#app')
